package com.lw.ai.model;////

import com.fasterxml.jackson.annotation.JsonView;
import com.lw.ai.dto.book.BookViews;
import com.lw.ai.enums.DataType;
import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class ResultNew {
    @JsonView(BookViews.UserView.class)
    private Integer code;
    @JsonView(BookViews.UserView.class)
    private String message;
    @JsonView(BookViews.UserView.class)
    private Object data;
    @JsonView(BookViews.UserView.class)
    private DataType dataType;

    public static  ResultNew success(Object data , DataType dataType) {
        return new ResultNew(200, "success", data, dataType);
    }

    public static  ResultNew failure(Integer code, String message) {
        return new ResultNew(code, message, null, null);
    }
}

